package leets.leet2341;

import java.util.HashSet;
import java.util.Set;

public class Solution {
    public int[] numberOfPairs(int[] nums) {
        Set<Integer> set=new HashSet<>();
        int res=0;
        for (int num : nums) {
            if (set.contains(num)) {
                set.remove(num);

                res++;
            } else {
                set.add(num);
            }
        }
        return new int[]{res,nums.length-res*2};
    }
}